#include <iostream>
#define max 20
#include <stdlib.h>
#include <stdio.h>
using namespace std;
typedef struct
{
    int r[max];
    int length;
}SqList;
void BInsertSort(SqList &L)
{
    int i,j,m,low,high;
    for(i=2;i<=L.length;i++)
    {
        L.r[0]=L.r[i];
        low=1;
        high=i-1;
        while(low<=high)
        {
            m=(low+high)/2;
            if(L.r[0]<L.r[m]) high=m-1;
            else low=m+1;
        }
        for(j=i-1;j>=high+1;j--)
            L.r[j+1]=L.r[j];
      L.r[high+1]=L.r[0];
      for(j=1;j<=L.length;j++)
            printf("%d ",L.r[j]);
      printf("\n");
    }
}
int main()
{
    SqList L;
    int i,n;
    scanf("%d",&n);
    L.length=n;
    for(i=1;i<=n;i++)
        scanf("%d",&L.r[i]);
    BInsertSort(L);
    return 0;
}
